#include "combinationnode.h"

CombinationNode::CombinationNode(QString lbl, double v, double sds, bool isObserved)
    :Node(lbl, v, sds, isObserved)
{
}

bool CombinationNode::inRange(double v)
{
    return true;
}

void CombinationNode::addNode(Node * node)
{
    nodes.append(node);
}

double CombinationNode::getValue()
{
    double v = 0.0;

    for(int i = 0; i < nodes.count(); i++)
    {
        v += nodes[i]->getValue();
    }

    return v;
}


void CombinationNode::addChildNode(Node * node)
{
    for(int i = 0; i < nodes.count(); i++)
    {
        nodes.at(i)->addChildNode(node);
    }
}
